In controlling a process, it is vital to be able to determine rapidly the value of one or more output control parameters. For instance, in an automotive environment, it is important for the engine control system to monitor the position of the engine throttle since it is a key indicator as to the driver's desired engine power. If the gas pedal is depressed quickly by the driver, the position of the throttle needs to be determined by the engine control system so that the airflow allowed to pass into the engine by the throttle is matched with engine fueling.
Unfortunately, in real-world control situations, such as in controlling the throttle position on an automotive engine, the throttle position output signals being sensed by the engine control system may be quite noisy. If the output signal is too noisy, the control system will react to the noise instead of the true output signal, thereby generating a control error. Therefore, a running average of output values or other types of low pass filters are typically employed to filter out such noise in order to make the signal values useful in controlling throttle position.
The number of calculations in a running average is proportional to the number of values in the running average. Each value to be used must be recovered from memory in a separate computational step, thus potentially requiring a fair amount of computational time. This can become a problem in a control system that must respond quickly to changing conditions. If the computational time exceeds the response time requirement for the system, the process cannot be controlled. This is a known problem when lower cost controllers are used such as in embedded controls, where the computation throughput is usually challenged by the required numerous computations.
The conventional method of performing an average throttle position calculation is to sum all the values and divide by the number of values summed. This requires N+2 computations, where N is the number of values summed. For example, a running average of 30 values requires 32 computations (30 retrievals, 1 summation, and 1 division), plus the software loop time to retrieve each previously saved value, to calculate the average. In an actual implementation, the newest value, Sample(t), obtained from a sensor, is saved in a circular or First In First Out (FIFO) queue, and the oldest value, Sample(t−N), is discarded. This operation is done just prior to performing the averaging calculation.
It is known in the art to shorten the average calculation by a first method as described in U.S. Pat. No. 5,869,752 to Klauber et al. In particular, during controller initialization, an initial average value is established using the conventional averaging method discussed above. The sum obtained is retained for future use. When an updated average is required at a time (t), the oldest value, Sample(1−N), obtained from the circular buffer is subtracted from the previously-retained sum, Sum(t−1), and the newest output value, Sample(t), obtained from the sensor is added to the previously-retained sum, as well as being stored in sequence in the buffer. The new sum, Sum(t) is then divided by the number, N, of values to obtain the latest average output value, Output1, which again is retained for future use in the next update. Thus, each value saved in the queue is not read at each update. The queue is not updated until the averaging calculation is completed because the oldest output value is required.
This method produces a result, Output1(t), equal to the result produced by the conventional averaging method. Mathematically,Sum(t)=Sum(t−1)−Sample(t−N)+Sample(t)  (Eq. 1)Output1(t)=Sum(t)/N  (Eq. 2)where Sum(t) is the latest sum, sum(t−1) is the previous sum, Sample(t−N) is the oldest sample value, sample(t) is the newest sample value, and Output1(t) is the running average output value. A disadvantage of this method is that a queue is required and must be maintained for each update.
A second and similar known short-cut method for approximating the running average is disclosed in U.S. Pat. No. 4,953,089 to Wolfe. As in the first method described above, during controller initialization, an initial average output value is established utilizing the conventional averaging method, and the sum is retained for future use. When an updated value, Sum(t), is required, the previous output value, Output2(t−1), is subtracted from the previously retained sum, Sum(t−1), and the newest value, Sample(t), is added to this sum. This sum, Sum(t), is then divided by the number of values, N, to obtain a running “average” value, Output2(t); the sum is also stored for future use. Mathematically,Sum(t)=Sum(t−1)−Output2(t−1)+Sample(t)  (Eq. 3)Output2(t)=Sum(t)/N  (Eq. 4)
Note that this method provides an Output2(t) that is only an approximation of the true average, Output1(t), and thus is suited for use only as a low pass filter and not for true averaging. The effect of a sample on the output of this method is dependent upon operating conditions and is usually indeterminate, but this method has the advantage of not requiring a queue.
A disadvantage is that the resulting value can have a significant deviation from the true average and also experiences a significant lag between the process output and the calculated value. When a controlled process begins to slide out of control, deviations from the former control average will become increasingly large. In the first method above, those deviations remain in the queue and progressively replace older members of the queue, such that the queue average will slowly follow the change in process output. In both methods, the effect of each new value is felt to 1/N its magnitude, but in the second method, that effect for each new value is felt only once, in calculating Output2, since that Output2 is discarded for the next calculation and we return once more to the original database minus Output2. Since Sample(t−N) is not systematically discarded, there is no mechanism for recognizing that the original database is becoming progressively unrepresentative of the current process output. This is not a problem if the sample deviations are indeed random noise and the process is remaining in control, but this method is slow to detect when the process is sliding out of control.
What is needed in the art is an improved method for reducing computational time for calculating a noise-filtered approximation of a true throttle position average wherein the deviation and phase lag are reduced. The present invention fills these needs as well as other needs.